class syncWaterfallHook {
    events = [];

    constructor() {
        console.log('syncWaterfallHook');
    }

    tap(name, cb) {
        cb = typeof cb === 'function' ? cb : (...args) => args;
        this.events.push(cb);
    }

    call(...args) {
        this.events.reduce((fn1, fn2) => {
            return (...args) => {
                return fn2(fn1(args))
            };
        })(args);
    }
}

module.exports = syncWaterfallHook;